<?php

/**
 * autenticacion actions.
 *
 * @package    cestudio
 * @subpackage autenticacion
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class autenticacionActions extends sfActions
{

public function executeIndex()
{
  $this->forward('autenticacion', 'login');
}
public function executeLogin()
{
  $this->error = '';
  if ($this->getRequest()->getMethod() == sfRequest::POST)
  {
    // Procesar los datos del formulario
    $login = $this->getRequestParameter('login');
    $password = $this->getRequestParameter('password');
    if($login=='admin' && $password=='123'){
      //Autenticar al usuario
      $this->getUser()->setAuthenticated(true);
      $this->getUser()->addCredential('administrador');
      $this->getUser()->addCredential('principal_index');
      $this->getUser()->addCredential('principal_mostrar');
      $this->error = '';
      $this->forward('principal', 'index');
    }else{
      $this->error = 'Error en el login/password';
    }
  }
}
public function executeLogout()
{
  if ($this->getUser()->isAuthenticated())
  {
    $this->getUser()->setAuthenticated(false);
  }
}


}
